﻿/*
 * Author: Brian Brewder
 * Website: http://redwerb.com
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Microsoft.VisualStudio.DebuggerVisualizers;
using System.Drawing;

[assembly: DebuggerVisualizer(typeof(Redwerb.Visualizers.ImageVisualizer.ImageVisualizer), typeof(VisualizerObjectSource), Target = typeof(System.Drawing.Image), Description = "Image Visualizer")]
[assembly: DebuggerVisualizer(typeof(Redwerb.Visualizers.ImageVisualizer.ImageVisualizer), typeof(VisualizerObjectSource), Target = typeof(System.Drawing.Bitmap), Description = "Image Visualizer")]

namespace Redwerb.Visualizers.ImageVisualizer
{
    
    public class ImageVisualizer
        : DialogDebuggerVisualizer
    {
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var img = objectProvider.GetObject() as Image;
            if (img == null) return;
            
            var dlg = new ImageVisualizerDialog();
            dlg.Image = img;
            dlg.ShowDialog();
        }
    }
}
